/*
 * @Author: your name
 * @Date: 2021-08-30 09:19:12
 * @LastEditTime: 2021-09-04 16:02:30
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\5-javascript\day06\1-数组的定义.js
 */
var arr1 = null; //空指针

//空数组
var arr2 = []; //字面量
var arr3 = new Array(); //构造函数

//有数据的数组
//1.字面量
var arr4 = [100, 200]; //在定义的同时进行赋值

var arr5 = [];
arr5[0] = 100;
arr5[1] = 200; //通过索引下标进行赋值

//2.构造函数
var arr6 = new Array();
arr6[0] = 100;
arr6[1] = 200; //通过索引下标进行赋值
//在定义的同时进行赋值
var arr7 = new Array(100, 200, { name: 'zs' });
arr7[1] = 300; //重新赋值
arr7[3] = 300; //又定义一个属性进行赋值
console.log(arr7, arr7.length);

//在定义的同时进行赋值
var arr8 = new Array(10); //只赋值了一个整型，指的是新建指定长度的空数组
console.log(arr8, arr8.length); //[ <10 empty items> ] 10

//不允许传递一个浮点型的数据
//var arr9 = new Array(10.1); !error

var arr10 = new Array('10.1');
console.log(arr10, arr10.length); //[ '10.1' ] 1